﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using eeenno.ReaderEngine.Utilities;

namespace eeenno.SpeeedReaderUI.Forms
{
    public partial class RegisterForm : Form
    {
        public RegisterForm()
        {
            InitializeComponent();
        }

        private void menuItem_register_Click(object sender, EventArgs e)
        {
            if (textBox_key.Text.Length > 0)
            {
                if (RegistrationManager.RegisterApplication(textBox_key.Text))
                {
                    MainForm.DisplayMessageBox("Product registration complete!");
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    MainForm.DisplayMessageBox("Product registration failed, please try again");
                }
            }
            else
            {
                MainForm.DisplayMessageBox("Please enter a registration key to complete registration");
            }
        }

        private void menuItem_cancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }

        private void menuItem_paste_Click(object sender, EventArgs e)
        {
            IDataObject obj = Clipboard.GetDataObject();
            string clipboard_text = "";
            clipboard_text = (string)obj.GetData(clipboard_text.GetType());
            if (clipboard_text != null)
            {
                textBox_key.Text = clipboard_text;
            }
        }
    }
}